package listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JOptionPane;

import frame.mainFrame;
import panel.HomePage;
import panel.ScorePage;
import panel.mainPanel;

public class LoginListener implements ActionListener{
	
	
	public LoginListener(){
		
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		 String zh=(String)HomePage.instance.zh.getText();
		 String ps=(String)String.valueOf(HomePage.instance.ps.getPassword());
		JButton b = (JButton) e.getSource();
		if(b==HomePage.instance.login){
			if(zh.equals("123")&&ps.equals("123")){
				JOptionPane.showMessageDialog(null, "登录成功！");
				mainFrame.instance.setVisible(true);
				HomePage.instance.setVisible(false);
				
			}else{
				JOptionPane.showMessageDialog(null, "账号或密码输入错误！");
				HomePage.instance.zh.grabFocus();
			}
		}	
	}
	
}
